import 'package:flutter/material.dart';

class MyCheckBox extends StatefulWidget {

  bool isChecked;
  Function(bool) onPressed;

  MyCheckBox({Key key,
    this.isChecked,
    this.onPressed
  }) : super(key: key);

  @override
  _MyCheckBoxState createState() => _MyCheckBoxState();
}

class _MyCheckBoxState extends State<MyCheckBox> {
  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () {
        widget.onPressed(widget.isChecked);
      },
      child: Container(
        width: 10,
        height: 10,
        decoration: widget.isChecked ?
          BoxDecoration(
            color: Color(0xff3a87fc),
            borderRadius: BorderRadius.circular(2)
          ) :
          BoxDecoration(
            border: Border.all(color: Color(0xff979797), width: 0.5),
            color: Colors.white,
            borderRadius: BorderRadius.circular(2)
          )
        ,
        child: widget.isChecked ? Icon(Icons.check, color: Colors.white, size: 7.5) : null,
      ),
    );
  }
}